import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '作业内容',
    align:"center",
    dataIndex: 'content'
  },
  {
    title: '预约编号',
    align:"center",
    dataIndex: 'number'
  },
  {
    title: '作业原因',
    align:"center",
    dataIndex: 'jobReason_dictText'
  },
  {
    title: '归属装置',
    align:"center",
    dataIndex: 'device_dictText'
  },
  {
    title: '归属单元',
    align:"center",
    dataIndex: 'cell_dictText'
  },
  {
    title: '作业类型',
    align:"center",
    dataIndex: 'jobType_dictText'
  },
  {
    title: '作业开始时间',
    align:"center",
    dataIndex: 'planStartDate'
  },
  {
    title: '作业结束时间',
    align:"center",
    dataIndex: 'planEndDate'
  },
  // {
  //   title: '作业所属部门',
  //   align:"center",
  //   dataIndex: 'applyCompany_dictText'
  // },
  {
    title: '作业申请人',
    align:"center",
    dataIndex: 'applicant_dictText'
  },
  {
    title: '申请时间',
    align:"center",
    dataIndex: 'applyTime'
  },
  {
    title: '作业部位',
    align:"center",
    dataIndex: 'position'
  },
  {
    title: '施工单位',
    align:"center",
    dataIndex: 'operationCompany'
  },
  // {
  //   title: '作业所属单位负责人',
  //   align:"center",
  //   dataIndex: 'operationChargePerson_dictText'
  // },
  {
    title: '施工单位负责人',
    align:"center",
    dataIndex: 'constructionMan'
  },
  {
    title: '作业地点',
    align:"center",
    dataIndex: 'locations'
  },
  {
    title: '公司监护人',
    align:"center",
    dataIndex: 'companyGuardian_dictText'
  },
  {
    title: '施工单位监护人',
    align:"center",
    dataIndex: 'constructionGuardian'
  },
  {
    title: '关联的其他特殊作业及安全作业票编号',
    align:"center",
    dataIndex: 'relevanceNumber'
  },
  {
    title: '危害辨识',
    align:"center",
    dataIndex: 'riskIdentificationResult_dictText'
  },
  {
    title: '定位',
    align:"center",
    dataIndex: 'orientation'
  },
  {
    title: '监控选择',
    align:"center",
    dataIndex: 'videoId_dictText'
  },
  {
    title: '作业状态',
    align:"center",
    dataIndex: 'status_dictText'
  },
  {
    title: '状态',
    align:"center",
    dataIndex: 'deleted_dictText'
  },
];

//列表数据
export const columnsCount: BasicColumn[] = [
  {
    title: '作业类型',
    align:"center",
    dataIndex: 'key',
    customRender:({text}) =>{
      if(text == '1'){
        return "动火作业";
      }else if(text == '2'){
        return "临时用电";
      }else if(text == '3'){
        return "吊装作业";
      }else if(text == '4'){
        return "盲板抽堵";
      }else if(text == '5'){
        return "动土作业";
      }else if(text == '6'){
        return "断路作业";
      }else if(text == '7'){
        return "受限空间作业";
      }else if(text == '8'){
        return "高处作业";
      }else if(text == '9'){
        return "通用作业";
      }else if(text == '10'){
        return "带压堵漏";
      }
    },
  },
  {
    title: '作业数量',
    align:"center",
    dataIndex: 'value'
  },
]

//子表列表数据
export const tbJobTicketAuditRecordColumns: BasicColumn[] = [
  {
    title: '审核人',
    align:"center",
    dataIndex: 'auditor_dictText'
  },
  {
    title: '审核时间',
    align:"center",
    dataIndex: 'auditTime'
  },
  {
    title: '审核状态',
    align:"center",
    dataIndex: 'status'
  },
  {
    title: '审核意见',
    align:"center",
    dataIndex: 'idea'
  },
];
//子表列表数据
export const tbJobTicketJsaAnalyzeColumns: BasicColumn[] = [
  {
    title: '危害因素名称',
    align:"center",
    dataIndex: 'hazardFactorName'
  },
  {
    title: '控制措施名称',
    align:"center",
    dataIndex: 'controlMeasureName'
  },
  {
    title: '作业类型',
    align:"center",
    dataIndex: 'jobType_dictText'
  },
  {
    title: '确认岗位',
    align:"center",
    dataIndex: 'confirmPost'
  },
  {
    title: '是否涉及',
    align:"center",
    dataIndex: 'isNotInvolves_dictText'
  },
  {
    title: '图片',
    align:"center",
    dataIndex: 'img',
    customRender:render.renderImage,
  },
];
//子表列表数据
export const tbJobTicketGasAnalysisColumns: BasicColumn[] = [
  {
    title: '分析项目',
    align:"center",
    dataIndex: 'analysisItem'
  },
  {
    title: '单位',
    align:"center",
    dataIndex: 'unit'
  },
  {
    title: '采样点',
    align:"center",
    dataIndex: 'samplingPoint'
  },
  {
    title: '分析结果',
    align:"center",
    dataIndex: 'analysisResult'
  },
  {
    title: '采样时间',
    align:"center",
    dataIndex: 'samplingTime'
  },
  {
    title: '阶段',
    align:"center",
    dataIndex: 'phase_dictText'
  },
  {
    title: '登记人',
    align:"center",
    dataIndex: 'registrant_dictText'
  },
  {
    title: '分析人',
    align:"center",
    dataIndex: 'analysisMan',
    customRender:render.renderImage,
  },
  {
    title: '分析结果图片',
    align:"center",
    dataIndex: 'img',
    customRender:render.renderImage,
  },
];
//子表列表数据
export const tbJobTicketMeasureRecordColumns: BasicColumn[] = [
  {
    title: '安全措施',
    align:"center",
    dataIndex: 'measure'
  },
  {
    title: '选项',
    align:"center",
    dataIndex: 'item'
  },
  {
    title: '确认岗位',
    align:"center",
    dataIndex: 'verifyPost'
  },
  {
    title: '确认人',
    align:"center",
    dataIndex: 'verifyMan_dictText'
  },
  {
    title: '确认时间',
    align:"center",
    dataIndex: 'verifyTime'
  },
  {
    title: '图片',
    align:"center",
    dataIndex: 'img',
    customRender:render.renderImage,
  },
];
//子表列表数据
export const tbJobTicketExamineRecordColumns: BasicColumn[] = [
  {
    title: '签发人角色',
    align:"center",
    dataIndex: 'auditorRole'
  },
  {
    title: '签发意见',
    align:"center",
    dataIndex: 'idea',
  },
  {
    title: '签发人照片',
    align:"center",
    dataIndex: 'auditorImg',
    customRender:render.renderImage,
  },
  {
    title: '确认时间',
    align:"center",
    dataIndex: 'confirmationTime'
  },
  {
    title: '是否现场签发',
    align:"center",
    dataIndex: 'isNotScene_dictText'
  },
  {
    title: '签发坐标',
    align:"center",
    dataIndex: 'coordinate'
  },
];
//子表列表数据
export const tbJobTicketSecurityDisclosureRecordColumns: BasicColumn[] = [
  {
    title: '作业许可范围及作业环境',
    align:"center",
    dataIndex: 'jobEnvironment'
  },
  {
    title: '防范措施（工艺、设备、个体防护等）',
    align:"center",
    dataIndex: 'preventiveMeasures'
  },
  {
    title: '应急措施',
    align:"center",
    dataIndex: 'emergencyMeasure'
  },
  {
    title: '其他注意事项',
    align:"center",
    dataIndex: 'attentionItem'
  },
  {
    title: '交底文件',
    align:"center",
    dataIndex: 'file',
    customRender:render.renderImage,
  },
];
//子表列表数据
export const tbJobTicketCourseRecordColumns: BasicColumn[] = [
  {
    title: '过程记录',
    align:"center",
    dataIndex: 'processRecord'
  },
  {
    title: '登记时间',
    align:"center",
    dataIndex: 'registerTime'
  },
  {
    title: '登记人',
    align:"center",
    dataIndex: 'register_dictText'
  },
  {
    title: '作业状态',
    align:"center",
    dataIndex: 'status_dictText'
  },
  {
    title: '登记部门',
    align:"center",
    dataIndex: 'registerDept_dictText'
  },
  // {
  //   title: '租户id',
  //   align:"center",
  //   dataIndex: 'tenantId'
  // },
];
//子表列表数据
export const tbJobTicketAcceptanceCheckRecordColumns: BasicColumn[] = [
  {
    title: '验收角色',
    align:"center",
    dataIndex: 'acceptanceCheckRole'
  },
  {
    title: '验收人',
    align:"center",
    dataIndex: 'acceptanceCheckMan',
    customRender:render.renderImage,
  },
  {
    title: '验收时间',
    align:"center",
    dataIndex: 'acceptanceCheckTime'
  },
  {
    title: '验收意见',
    align:"center",
    dataIndex: 'idea'
  },
  {
    title: '是否现场验收',
    align:"center",
    dataIndex: 'isNotScene_dictText'
  },
  {
    title: '验收坐标',
    align:"center",
    dataIndex: 'coordinate'
  },
  // {
  //   title: '排序',
  //   align:"center",
  //   dataIndex: 'sequence'
  // },
];
//子表列表数据
export const tbJobTicketProblemRecordColumns: BasicColumn[] = [
  {
    title: '问题描述',
    align:"center",
    dataIndex: 'descripion'
  },
  {
    title: '所在单位',
    align:"center",
    dataIndex: 'owningCompan'
  },
  {
    title: '所属承包商',
    align:"center",
    dataIndex: 'contractor_dictText'
  },
  {
    title: '问题状态',
    align:"center",
    dataIndex: 'problemStatus_dictText'
  },
  {
    title: '附件',
    align:"center",
    dataIndex: 'imf',
    customRender:render.renderImage,
  },
];
//子表列表数据
export const tbJobTicketViolationCaptureColumns: BasicColumn[] = [
  {
    title: '摄像头名称',
    align:"center",
    dataIndex: 'name'
  },
  {
    title: '报警类型',
    align:"center",
    dataIndex: 'alarmType'
  },
  {
    title: '报警时间',
    align:"center",
    dataIndex: 'alarmTime'
  },
  {
    title: '视频截图',
    align:"center",
    dataIndex: 'img',
  },
];

// 高级查询数据
export const superQuerySchema = {
  content: {title: '作业内容',order: 0,view: 'textarea', type: 'string',},
  number: {title: '预约编号',order: 1,view: 'text', type: 'string',},
  jobReason: {title: '作业原因',order: 2,view: 'list', type: 'string',dictCode: 'jobReason',},
  device: {title: '归属装置',order: 3,view: 'list', type: 'string',dictTable: "tb_base_risk_device", dictCode: 'id', dictText: 'name',},
  cell: {title: '归属单元',order: 4,view: 'list', type: 'string',dictTable: "tb_base_risk_unit", dictCode: 'id', dictText: 'risk_unit_name',},
  jobType: {title: '作业类型',order: 5,view: 'checkbox', type: 'string',dictCode: 'jobType',},
  planStartDate: {title: '作业开始时间',order: 6,view: 'datetime', type: 'string',},
  planEndDate: {title: '作业结束时间',order: 7,view: 'datetime', type: 'string',},
  applyCompany: {title: '作业所属部门',order: 8,view: 'sel_depart', type: 'string',},
  applicant: {title: '作业申请人',order: 9,view: 'sel_user', type: 'string',},
  applyTime: {title: '申请时间',order: 10,view: 'datetime', type: 'string',},
  position: {title: '作业部位',order: 11,view: 'text', type: 'string',},
  operationCompany: {title: '施工单位',order: 12,view: 'text', type: 'string',},
  operationChargePerson: {title: '作业所属单位负责人',order: 13,view: 'sel_user', type: 'string',},
  constructionMan: {title: '施工单位负责人',order: 14,view: 'text', type: 'string',},
  locations: {title: '作业地点',order: 15,view: 'text', type: 'string',},
  companyGuardian: {title: '公司监护人',order: 16,view: 'sel_user', type: 'string',},
  constructionGuardian: {title: '施工单位监护人',order: 17,view: 'text', type: 'string',},
  relevanceNumber: {title: '关联的其他特殊作业及安全作业票编号',order: 18,view: 'list_multi', type: 'string',},
  riskIdentificationResult: {title: '危害辨识',order: 19,view: 'list_multi', type: 'string',dictCode: 'jobRiskIdentification',},
  orientation: {title: '定位',order: 20,view: 'text', type: 'string',},
  videoId: {title: '监控选择',order: 21,view: 'list_multi', type: 'string',dictTable: "tb_video", dictCode: 'id', dictText: 'name',},
  status: {title: '作业状态',order: 22,view: 'radio', type: 'string',dictCode: 'jobStatus',},
  deleted: {title: '状态',order: 23,view: 'radio', type: 'string',dictCode: 'normalOrStop',},
};

//列表数据
export const relevanceJobTicketColumns: BasicColumn[] = [
  {
    title: '编号',
    align:"center",
    dataIndex: 'number'
  },
  {
    title: '作业内容',
    align:"center",
    dataIndex: 'content'
  },
  {
    title: '归属装置',
    align:"center",
    dataIndex: 'device_dictText'
  },
  {
    title: '归属单元',
    align:"center",
    dataIndex: 'cell_dictText'
  },
  {
    title: '作业类型',
    align:"center",
    dataIndex: 'jobType_dictText'
  },
];

//查询数据
export const relevanceJobTicketSearchFormSchema: FormSchema[] = [
  {
    label: "作业内容",
    field: "content",
    component: 'Input',
  },
  {
    label: "作业类型",
    field: "jobType",
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"jobType"
    },
  },
];
